<template>
  <tr>
    <td>合计:</td>
    <td colspan="5">{{ isAllPrice }}</td>
  </tr>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: 'Total',
  computed: {
    ...mapState(['goodList']),
    isAllPrice() {
      return this.goodList.reduce(
        (sum, item) => (item.checked ? (sum += item.price * item.num) : sum),
        0
      )
    },
  },
}
</script>

<style></style>
